// pages/components/customNavBackk/customNavBackk.js
var app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    className: {
      type: String,
      value: '',
      observer(newVal) {}
    },
    title: {
      type: String,
      value: '',
      observer(newVal) {}
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    bangsHeight:wx.getStorageSync('navBarObj').bangsHeight,
    isHome:false
  },
  attached(){
    let isSm=wx.getLaunchOptionsSync();
    let page=getCurrentPages();
    if(isSm && isSm.scene!='1001' &&  page.length == 1){
      this.setData({isHome:true})
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    goBack(){
      if(this.data.isHome == true){
        wx.switchTab({
          url: '/pages/index/index',
        })
      }else{
        wx.navigateBack({ 
          fail: function(error) { 
            wx.switchTab({
              url: '/pages/index/index',
            })
          }
        });
      }
      
    }
  }
})